home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / util1 / pf2.lha / patchfor020.asm < prev    next >
Assembly Source File  |  1995-09-12  |  41KB  |  2,135 lines

  1.         section    multiselect,code
  2.  
  3.         include    'includes:misc/os3_gst.i'
  4.  
  5. *-------------- Open dos library..
  6.  
  7.         move.l    4.w,a6
  8.         lea    DOSName(pc),a1
  9.         jsr    -408(a6)
  10.         move.l    d0,_DOSBase
  11.         beq.w    NoLib
  12.  
  13.         lea    About.txt,a0
  14.         bsr.w    putstr
  15.  
  16. *-------------- Open reqtools library..
  17.  
  18.         lea    ReqName(pc),a1
  19.         move.l    #REQTOOLSVERSION,d0
  20.         jsr    -552(a6)
  21.         move.l    d0,_RTBase
  22.         beq.w    closedos
  23.         move.l    d0,a6
  24.  
  25. ******************************************************************************
  26. *-------------- Allocate a Reqtools File Requester
  27.  
  28.         move.l    #RT_FILEREQ,d0
  29.         suba.l    a0,a0
  30.         jsr    _LVOrtAllocRequestA(a6)
  31.         move.l    d0,filereq
  32.         beq.w    ok17
  33.  
  34. *-------------- set default dir..
  35.  
  36.         lea    defdir_tags(pc),a0
  37.         move.l    d0,a1
  38.         jsr    _LVOrtChangeReqAttrA(a6)
  39.  
  40. *-------------- multiselect some filenames...
  41.  
  42.         move.l    filereq(pc),a1
  43.         lea    filename,a2
  44.         lea    Text66(pc),a3
  45.         lea    Tags9(pc),a0
  46.         jsr    _LVOrtFileRequestA(a6)
  47.         move.l    d0,flist
  48.         beq.w    ok16
  49.  
  50. ******************************************************************************
  51. *-------------- allocate a volume requester..
  52.  
  53.         move.l    #RT_FILEREQ,d0
  54.         sub.l    a0,a0
  55.         jsr    _LVOrtAllocRequestA(a6)
  56.         move.l    d0,volreq
  57.         beq.w    freelist            ;free multilist..
  58.  
  59. *-------------- select destination path..
  60.  
  61.         lea    volpath,a1
  62.         clr.b    (a1)
  63.  
  64.         suba.l    a2,a2
  65.         lea    Text89(pc),a3
  66.         lea    Tags11(pc),a0
  67.         move.l    volreq(pc),a1
  68.         jsr    _LVOrtFileRequestA(a6)
  69.         tst.l    d0
  70.         beq.s    vol_error
  71.  
  72. *-------------- selection ok...
  73.  
  74.         move.l    volreq(pc),a0
  75.         move.l    rtfi_Dir(a0),a0
  76.         lea    volpath,a1
  77. get_volname:    move.b    (a0)+,(a1)+
  78.         bne.s    get_volname
  79.         bra.s    vol_free
  80.  
  81. *-------------- selection cancelled or failed..
  82.  
  83. vol_error    lea    NoPath.txt(pc),a0
  84.         bsr.w    putstr
  85.  
  86. vol_free    move.l    volreq(pc),a1
  87.         jsr    _LVOrtFreeRequest(a6)
  88.  
  89.  
  90. ******************************************************************************
  91. *-------------- process all filenames in the list...
  92.         
  93.         move.l    flist(pc),a6
  94. nextfile:
  95.         lea    finalname,a5
  96.         move.l    a5,a1
  97.  
  98.         move.l    filereq(pc),a0
  99.         move.l    rtfi_Dir(a0),d0
  100.         beq.s    no_slash
  101.         move.l    d0,a0
  102.         move.l    rtfl_Name(a6),d1
  103.         beq.s    nextname
  104.         
  105. bytecopy:    move.b    (a0)+,(a1)+
  106.         bne.s    bytecopy
  107.         cmp.b    #":",-2(a1)
  108.         bne.s    add_slash
  109.         tst.b    -(a1)
  110.         bra.s    no_slash
  111. add_slash:    tst.b    -(a1)
  112.         move.b    #"/",(a1)+
  113. no_slash:    move.l    d1,a0
  114. bytecopy2:    move.b    (a0)+,(a1)+
  115.         bne.s    bytecopy2
  116.         clr.b    (a1)+
  117.         move.l    a5,d0
  118.  
  119. *-------------- d0.l = final filename..
  120.  
  121.         bsr.s    process            ;process files in linked list.
  122.         tst.l    d0            ;abort processing of files??
  123.         bne.s    aborted
  124.  
  125. nextname    move.l    rtfl_Next(a6),a6
  126.         cmp.l    #0,a6
  127.         bne.s    nextfile
  128.  
  129.         lea    Done.txt(pc),a0
  130.         bsr.w    putstr
  131.  
  132. *-------------- free list of filenames..
  133.  
  134. freelist
  135. aborted        move.l    flist(pc),a0
  136.         move.l    _RTBase,a6
  137.         jsr    _LVOrtFreeFileList(a6)
  138.  
  139. *-------------- free file requesters..
  140.  
  141. ok16        move.l    filereq(pc),a1
  142.         jsr    _LVOrtFreeRequest(a6)
  143.  
  144. *-------------- close reqtools library..
  145.  
  146. closelibs
  147. ok17        move.l    _RTBase(pc),a1
  148.         move.l    4.w,a6
  149.         jsr    -414(a6)
  150.  
  151. *-------------- close dos library..
  152.  
  153. closedos:    move.l    _DOSBase(pc),a1
  154.         move.l    4.w,a6
  155.         jsr    -414(a6)
  156.  
  157. NoLib:        moveq    #0,d0
  158.         rts
  159.  
  160.  
  161.  
  162.  
  163. process        movem.l    d1-d7/a0-a6,-(sp)
  164.  
  165. *-------------- Attempt to load this file..
  166.  
  167. LoadFile:    move.l    d0,-(sp)
  168.         lea    Load.txt(pc),a0
  169.         bsr.w    putstr
  170.         move.l    (sp),a0
  171.         bsr.w    putstr
  172.         lea    LF.txt(pc),a0
  173.         bsr.w    putstr
  174.         lea    LF.txt(pc),a0
  175.         bsr.w    putstr
  176.         move.l    (sp),a0
  177.         bsr.w    LoadDOSFile
  178.         move.l    (sp)+,a0
  179.         tst.l    d0
  180.         beq.s    Load_Okay
  181.  
  182.         cmp.l    #-2,d0
  183.         bne.s    notf
  184.  
  185. *-------------- out of memory
  186.  
  187.         move.l    a0,-(sp)
  188.         lea    ErrorMem.txt(pc),a0
  189.         bsr.w    putstr
  190.         move.l    (sp)+,a0
  191.         bra.b    nosave
  192.  
  193. *-------------- file not found
  194. notf
  195.         move.l    a0,-(sp)
  196.         lea    ErrorLoad.txt(pc),a0
  197.         bsr.w    putstr
  198.         move.l    (sp)+,a0
  199.         bra.b    nosave
  200.  
  201. Load_Okay:    bsr.w    sort_destname
  202.  
  203.         move.l    d0,-(sp)
  204.         bsr.w    ScanIt
  205.         move.l    (sp)+,a0        ;a0=filename..
  206.  
  207.         move.l    a0,Savename
  208.  
  209. *-------------- Attempt to save this file..
  210.  
  211. SaveFile:    tst.b    patched
  212.         beq.s    skip_save
  213.         
  214.         lea    Save.txt(pc),a0
  215.         bsr.w    putstr
  216.         move.l    Savename(pc),a0
  217.         bsr.w    putstr
  218.         lea    LF.txt(pc),a0
  219.         bsr.w    putstr
  220.  
  221. *-------------- write file out..
  222.  
  223.         move.l    Savename,a0
  224.         move.l    ProgBuff(pc),a1
  225.         move.l    ProgSize(pc),d1
  226.         bsr.w    SaveDOSFile
  227.         tst.l    d0
  228.         beq.s    Save_Okay
  229.  
  230.         lea    ErrorSave.txt(pc),a0
  231.         bsr.w    putstr
  232. Save_Okay
  233.  
  234. nosave        clr.b    patched
  235.  
  236.         bsr.w    FreeDOSFile
  237.  
  238. *-------------- abort processing of files if CTRL+C was pressed...
  239.  
  240.         bsr.b    _CheckBreak
  241.  
  242.         movem.l    (sp)+,d1-d7/a0-a6
  243.         rts
  244.  
  245. skip_save:    lea    skip_save.txt(pc),a0
  246.         bsr.w    putstr
  247.         bra.s    nosave
  248.  
  249.  
  250. _CheckBreak:    moveq    #0,d0
  251.         moveq    #0,d1
  252.         bset.l    #SIGBREAKB_CTRL_C,d1    ;check for CTRL_C
  253.         move.l    _DOSBase(pc),a6
  254.         jsr    _LVOCheckSignal(a6)    ;did user signal a break??
  255.  
  256.         btst.l    #SIGBREAKB_CTRL_C,d0
  257.         beq.s    NoBreak
  258. WasBroken:    moveq    #1,d0            ;yes.. user tried to break..
  259.         rts
  260.  
  261. NoBreak:    moveq    #0,d0            ;no break
  262.         rts
  263.  
  264. ScanIt:        movem.l    d0-d7/a0-a6,-(sp)
  265.  
  266.  
  267. ********************************************************************************
  268. *-------------- scan for "Long Muls"
  269.  
  270. _PASS1:        lea    Find_Muls.l.txt(pc),a0
  271.         bsr.w    PutString
  272.  
  273.         move.l    ProgBuff(pc),a0        ;a0.l = Start of file SOF
  274.         move.l    a0,a1
  275.         add.l    ProgSize(pc),a1        ;a1.l = End of file EOF
  276.         lea    SASC_Muls(pc),a2    ;a2.l = Binary to find...
  277.         moveq    #(SASC_Muls_End-SASC_Muls)-2,d0    ;length of binary.
  278.         bsr.w    FindBinary
  279.         bne.s    not_found1
  280.  
  281.         st    patched
  282.         
  283. *-------------- patch the Multiply Signed routine...
  284.  
  285.         lea    my020_Muls(pc),a1
  286.         exg.l    a1,a0
  287.         moveq    #30,d0            ;no.of bytes to copy
  288.         bsr.w    CopyMem
  289.  
  290.         lea    Patched.txt(pc),a0
  291.         bsr.w    PutString
  292.         bra.s    was_found1
  293.  
  294. *-------------- skip patching Multiply Signed routine..
  295.  
  296. not_found1:    lea    NotPatched.txt(pc),a0
  297.         bsr.w    PutString
  298.  
  299. was_found1:
  300.  
  301.  
  302. ********************************************************************************
  303. _PASS2:
  304.  
  305.         lea    Find_Mulu.l.txt(pc),a0
  306.         bsr.w    PutString
  307.  
  308.         move.l    ProgBuff(pc),a0        ;a0.l = Start of file SOF
  309.         move.l    a0,a1
  310.         add.l    ProgSize(pc),a1        ;a1.l = End of file EOF
  311.         lea    SASC_Mulu(pc),a2    ;a2.l = Binary to find...
  312.         moveq    #(SASC_Mulu_End-SASC_Mulu)-2,d0    ;length of binary.
  313.         bsr.w    FindBinary
  314.         bne.s    not_found2
  315.  
  316.         st    patched
  317.         
  318. *-------------- patch the Multiply Unsigned routine...
  319.  
  320.         lea    my020_Mulu(pc),a1
  321.         exg.l    a1,a0
  322.         moveq    #32,d0            ;no.of bytes to copy
  323.         bsr.w    CopyMem
  324.  
  325.         lea    Patched.txt(pc),a0
  326.         bsr.w    PutString
  327.         bra.s    was_found2
  328.  
  329. *-------------- skip patching Multiply Signed routine..
  330.  
  331. not_found2:    lea    NotPatched.txt(pc),a0
  332.         bsr.w    PutString
  333.  
  334. was_found2:
  335.  
  336.  
  337.  
  338.  
  339.  
  340. ********************************************************************************
  341. _PASS3:
  342.         lea    Find_Divsl.l.txt(pc),a0
  343.         bsr.w    PutString
  344.  
  345.         move.l    ProgBuff(pc),a0        ;a0.l = Start of file SOF
  346.         move.l    a0,a1
  347.         add.l    ProgSize(pc),a1        ;a1.l = End of file EOF
  348.         lea    SASC_Divsl(pc),a2    ;a2.l = Binary to find...
  349.         moveq    #54,d0            ;length of binary.
  350.         bsr.w    FindBinary
  351.         bne.s    not_found3
  352.  
  353.         st    patched
  354.         
  355. *-------------- patch the Divide Unsigned routine...
  356.  
  357.         lea    50(a0),a0
  358.         lea    my020_Divsl(pc),a1
  359.         exg.l    a1,a0
  360.         move.l    #32,d0            ;no.of bytes to copy
  361.         bsr.w    CopyMem
  362.  
  363.         lea    Patched.txt(pc),a0
  364.         bsr.w    PutString
  365.         bra.s    was_found3
  366.  
  367. *-------------- skip patching Multiply Signed routine..
  368.  
  369. not_found3:    lea    NotPatched.txt(pc),a0
  370.         bsr.w    PutString
  371.  
  372. was_found3:
  373.  
  374.  
  375.  
  376. ********************************************************************************
  377. _PASS4:        lea    Find_MulsOther.l.txt(pc),a0
  378.         bsr.w    PutString
  379.  
  380.         move.l    ProgBuff(pc),a0        ;a0.l = Start of file SOF
  381.         move.l    a0,a1
  382.         add.l    ProgSize(pc),a1        ;a1.l = End of file EOF
  383.         lea    OTHER_Muls(pc),a2    ;a2.l = Binary to find...
  384.         moveq    #(OTHER_Muls_End-OTHER_Muls)-2,d0    ;length of binary.
  385.         bsr.w    FindBinary
  386.         bne.s    not_found4
  387.  
  388.         st    patched
  389.         
  390. *-------------- patch the Multiply Unsigned routine...
  391.  
  392.         lea    my020_Muls(pc),a1
  393.         exg.l    a1,a0
  394.         moveq    #6,d0            ;no.of bytes to copy
  395.         bsr.w    CopyMem
  396.  
  397.         lea    Patched.txt(pc),a0
  398.         bsr.w    PutString
  399.         bra.s    was_found4
  400.  
  401. *-------------- skip patching Multiply Signed routine..
  402.  
  403. not_found4:    lea    NotPatched.txt(pc),a0
  404.         bsr.w    PutString
  405.  
  406. was_found4:
  407.  
  408. ********************************************************************************
  409.  
  410. _PASS5:        lea    Find_MulsOther2.l.txt(pc),a0
  411.         bsr.w    PutString
  412.  
  413.         move.l    ProgBuff(pc),a0        ;a0.l = Start of file SOF
  414.         move.l    a0,a1
  415.         add.l    ProgSize(pc),a1        ;a1.l = End of file EOF
  416.         lea    OTHER2_Muls(pc),a2    ;a2.l = Binary to find...
  417.         moveq    #(OTHER2_Muls_End-OTHER2_Muls)-2,d0    ;length of binary.
  418.         bsr.w    FindBinary
  419.         bne.s    not_found5
  420.  
  421.         st    patched
  422.         
  423. *-------------- patch the Multiply Unsigned routine...
  424.  
  425.         lea    my020_Muls(pc),a1
  426.         exg.l    a1,a0
  427.         moveq    #6,d0            ;no.of bytes to copy
  428.         bsr.w    CopyMem
  429.  
  430.         lea    Patched.txt(pc),a0
  431.         bsr.w    PutString
  432.         bra.s    was_found5
  433.  
  434. *-------------- skip patching Multiply Signed routine..
  435.  
  436. not_found5:    lea    NotPatched.txt(pc),a0
  437.         bsr.w    PutString
  438.  
  439. was_found5:
  440.  
  441.  
  442.  
  443. *******************************************************************************
  444. * Lets try to patch the "DICE Muls" routine...
  445.  
  446.  
  447. _PASS6:        lea    Find_MulsDice.l.txt(pc),a0
  448.         bsr.w    PutString
  449.  
  450.         move.l    ProgBuff(pc),a0        ;a0.l = Start of file SOF
  451.         move.l    a0,a1
  452.         add.l    ProgSize(pc),a1        ;a1.l = End of file EOF
  453.         lea    _Dice_Muls(pc),a2    ;a2.l = Binary to find...
  454.         moveq    #(_Dice_Muls_End-_Dice_Muls)-2,d0    ;length of binary.
  455.         bsr.w    FindBinary
  456.         bne.s    not_found6
  457.  
  458.         st    patched
  459.         
  460. *-------------- patch the Multiply Unsigned routine...
  461.  
  462.         lea    _Dice_Muls020(pc),a1
  463.         exg.l    a1,a0
  464.         moveq    #_Dice_Muls020_End-_Dice_Muls020,d0    ;no.of bytes to copy
  465.         bsr.w    CopyMem
  466.  
  467.         lea    Patched.txt(pc),a0
  468.         bsr.w    PutString
  469.         bra.s    was_found6
  470.  
  471. *-------------- skip patching Multiply Signed routine..
  472.  
  473. not_found6:    lea    NotPatched.txt(pc),a0
  474.         bsr.w    PutString
  475.  
  476. was_found6:
  477.  
  478. ********************************************************************************
  479.  
  480. _PASS7:
  481.         lea    Find_Divsl2.l.txt(pc),a0
  482.         bsr.w    PutString
  483.  
  484.         move.l    ProgBuff(pc),a0        ;a0.l = Start of file SOF
  485.         move.l    a0,a1
  486.         add.l    ProgSize(pc),a1        ;a1.l = End of file EOF
  487.         lea    divides(pc),a2        ;a2.l = Binary to find...
  488.         move.l    #(divides_end-divides)-2,d0    ;length of binary.
  489.         bsr.w    FindBinary
  490.         bne.s    not_found7
  491.  
  492.         st    patched
  493.  
  494.         move.l    a0,-(sp)
  495.  
  496. *-------------- patch "divsl.l"
  497.         lea    _Divsl.l.020(pc),a0        ;00
  498.         move.l    (sp),a1
  499.         move.l    #_Divsl.l.020_end-_Divsl.l.020,d0
  500.         bsr.w    CopyMem
  501.         
  502. *-------------- patch "divsl.r"
  503.         lea    _Divsl.r020(pc),a0        ;40
  504.         move.l    (sp),a1
  505.         lea    40(a1),a1
  506.         move.l    #_Divsl.r020_end-_Divsl.r020,d0
  507.         bsr.w    CopyMem
  508.                 
  509. *-------------- patch "divul.r"
  510.         lea    _Divul.r020(pc),a0        ;66
  511.         move.l    (sp),a1
  512.         lea    66(a1),a1
  513.         move.l    #_Divul.r020_end-_Divul.r020,d0
  514.         bsr.w    CopyMem
  515.  
  516. *-------------- patch "divul.l"
  517.         lea    _Divul.l.020(pc),a0        ;78
  518.         move.l    (sp)+,a1
  519.         lea    78(a1),a1
  520.         move.l    #_Divul.l.020_end-_Divul.l.020,d0
  521.         bsr.w    CopyMem
  522.         
  523.         lea    Patched.txt(pc),a0
  524.         bsr.w    PutString
  525.         bra.s    was_found7
  526.  
  527. *-------------- skip patching Multiply Signed routine..
  528.  
  529. not_found7:    lea    NotPatched.txt(pc),a0
  530.         bsr.w    PutString
  531.  
  532. was_found7:
  533.  
  534.  
  535. ********************************************************************************
  536.  
  537. _PASS8:
  538.         lea    Find_Divsl3.l.txt(pc),a0
  539.         bsr.w    PutString
  540.  
  541.         move.l    ProgBuff(pc),a0        ;a0.l = Start of file SOF
  542.         move.l    a0,a1
  543.         add.l    ProgSize(pc),a1        ;a1.l = End of file EOF
  544.         lea    divides2(pc),a2        ;a2.l = Binary to find...
  545.         move.l    #(divides2_end-divides2)-2,d0    ;length of binary.
  546.         bsr.w    FindBinary
  547.         bne.s    not_found8
  548.  
  549.         st    patched
  550.  
  551.         move.l    a0,-(sp)
  552.  
  553. *-------------- patch "divul.rem"
  554.  
  555.         lea    Divul.rem(pc),a0        ;00
  556.         move.l    (sp),a1
  557.         move.l    #Divul.rem_end-Divul.rem,d0
  558.         bsr.w    CopyMem
  559.  
  560. *-------------- patch "divsl.neg"
  561.  
  562.         lea    Divsl.neg(pc),a0        ;78
  563.         move.l    (sp)+,a1
  564.         lea    78(a1),a1
  565.         move.l    #Divsl.neg_end-Divsl.neg,d0
  566.         bsr.w    CopyMem
  567.         
  568.         lea    Patched.txt(pc),a0
  569.         bsr.w    PutString
  570.         bra.s    was_found8
  571.  
  572. *-------------- skip patching Multiply Signed routine..
  573.  
  574. not_found8:    lea    NotPatched.txt(pc),a0
  575.         bsr.w    PutString
  576.  
  577. was_found8:
  578.  
  579.  
  580. ********************************************************************************
  581.  
  582. _PASS9:        lea    Find_MulsOther3.l.txt(pc),a0
  583.         bsr.w    PutString
  584.  
  585.         move.l    ProgBuff(pc),a0        ;a0.l = Start of file SOF
  586.         move.l    a0,a1
  587.         add.l    ProgSize(pc),a1        ;a1.l = End of file EOF
  588.         lea    Mul3(pc),a2        ;a2.l = Binary to find...
  589.         moveq    #(Mul3_End-Mul3)-2,d0    ;length of binary.
  590.         bsr.w    FindBinary
  591.         bne.s    not_found9
  592.  
  593.         st    patched
  594.         
  595. *-------------- patch the Multiply Unsigned routine...
  596.  
  597.         lea    Mul3_020(pc),a1
  598.         exg.l    a1,a0
  599.         moveq    #Mul3_020_End-Mul3_020,d0    ;no.of bytes to copy
  600.         bsr.w    CopyMem
  601.  
  602.         lea    Patched.txt(pc),a0
  603.         bsr.w    PutString
  604.         bra.s    was_found9
  605.  
  606. *-------------- skip patching Multiply Signed routine..
  607.  
  608. not_found9:    lea    NotPatched.txt(pc),a0
  609.         bsr.w    PutString
  610.  
  611. was_found9:
  612.  
  613.  
  614. ********************************************************************************
  615.  
  616. _PASS10:
  617.         lea    Find_Divsl4.l.txt(pc),a0
  618.         bsr.w    PutString
  619.  
  620.         move.l    ProgBuff(pc),a0        ;a0.l = Start of file SOF
  621.         move.l    a0,a1
  622.         add.l    ProgSize(pc),a1        ;a1.l = End of file EOF
  623.         lea    divides3(pc),a2        ;a2.l = Binary to find...
  624.         move.l    #(divides3_end-divides3)-2,d0    ;length of binary.
  625.         bsr.w    FindBinary
  626.         bne.s    not_found10
  627.  
  628.         st    patched
  629.  
  630. *-------------- patch div
  631.  
  632.         lea    div(pc),a1        ;00
  633.         exg.l    a1,a0
  634.         move.l    #div_end-div,d0
  635.         bsr.w    CopyMem
  636.         
  637.         lea    Patched.txt(pc),a0
  638.         bsr.w    PutString
  639.         bra.s    was_found10
  640.  
  641. *-------------- skip patching Multiply Signed routine..
  642.  
  643. not_found10:    lea    NotPatched.txt(pc),a0
  644.         bsr.w    PutString
  645.  
  646. was_found10:
  647.  
  648.  
  649. ********************************************************************************
  650.  
  651. _PASS11:
  652.         lea    Find_Divsl5.l.txt(pc),a0
  653.         bsr.w    PutString
  654.  
  655.         move.l    ProgBuff(pc),a0        ;a0.l = Start of file SOF
  656.         move.l    a0,a1
  657.         add.l    ProgSize(pc),a1        ;a1.l = End of file EOF
  658.         lea    divides4(pc),a2        ;a2.l = Binary to find...
  659.         move.l    #(divides4_end-divides4)-2,d0    ;length of binary.
  660.         bsr.w    FindBinary
  661.         bne.s    not_found11
  662.  
  663.         st    patched
  664.  
  665. *-------------- patch div
  666.  
  667.         lea    div4(pc),a1        ;00
  668.         exg.l    a1,a0
  669.         move.l    #div4_end-div4,d0
  670.         bsr.w    CopyMem
  671.         
  672.         lea    Patched.txt(pc),a0
  673.         bsr.w    PutString
  674.         bra.s    was_found11
  675.  
  676. *-------------- skip patching Multiply Signed routine..
  677.  
  678. not_found11:    lea    NotPatched.txt(pc),a0
  679.         bsr.w    PutString
  680.  
  681. was_found11:
  682.  
  683.  
  684. ********************************************************************************
  685. * Patch manx mulu routines...
  686.  
  687. _PASS12:
  688.         lea    manxmulu.txt(pc),a0
  689.         bsr.w    PutString
  690.  
  691.         move.l    ProgBuff(pc),a0        ;a0.l = Start of file SOF
  692.         move.l    a0,a1
  693.         add.l    ProgSize(pc),a1        ;a1.l = End of file EOF
  694.         lea    manxmulu(pc),a2        ;a2.l = Binary to find...
  695.         move.l    #(manxmulu_end-manxmulu)-2,d0    ;length of binary.
  696.         bsr.w    FindBinary
  697.         bne.s    not_found12
  698.  
  699.         st    patched
  700.  
  701. *-------------- patch mulu
  702.  
  703.         lea    manxmulu020(pc),a1        ;00
  704.         exg.l    a1,a0
  705.         move.l    #manxmulu020_end-manxmulu020,d0
  706.         bsr.w    CopyMem
  707.         
  708.         lea    Patched.txt(pc),a0
  709.         bsr.w    PutString
  710.         bra.s    was_found12
  711.  
  712. *-------------- skip patching Multiply Signed routine..
  713.  
  714. not_found12:    lea    NotPatched.txt(pc),a0
  715.         bsr.w    PutString
  716.  
  717. was_found12:
  718.  
  719.  
  720. ********************************************************************************
  721. * Patch manx divs routines...
  722.  
  723. _PASS13:
  724.         lea    manxdivs.txt(pc),a0
  725.         bsr.w    PutString
  726.  
  727.         move.l    ProgBuff(pc),a0        ;a0.l = Start of file SOF
  728.         move.l    a0,a1
  729.         add.l    ProgSize(pc),a1        ;a1.l = End of file EOF
  730.         lea    manxdivs(pc),a2        ;a2.l = Binary to find...
  731.         move.l    #(manxdivs_end-manxdivs)-2,d0    ;length of binary.
  732.         bsr.w    FindBinary
  733.         bne.s    not_found13
  734.  
  735.         st    patched
  736.  
  737. *-------------- patch manx divs
  738.  
  739.         lea    manxdivs020(pc),a1        ;00
  740.         exg.l    a1,a0
  741.         move.l    #manxdivs020_end-manxdivs020,d0
  742.         bsr.w    CopyMem
  743.         
  744.         lea    Patched.txt(pc),a0
  745.         bsr.w    PutString
  746.         bra.s    was_found13
  747.  
  748. *-------------- skip patching Multiply Signed routine..
  749.  
  750. not_found13:    lea    NotPatched.txt(pc),a0
  751.         bsr.w    PutString
  752.  
  753. was_found13:
  754.  
  755.  
  756.  
  757. ********************************************************************************
  758. * Patch manx divneg routines...
  759.  
  760. _PASS14:
  761.         lea    manxdivneg.txt(pc),a0
  762.         bsr.w    PutString
  763.  
  764.         move.l    ProgBuff(pc),a0        ;a0.l = Start of file SOF
  765.         move.l    a0,a1
  766.         add.l    ProgSize(pc),a1        ;a1.l = End of file EOF
  767.         lea    manxdivneg(pc),a2        ;a2.l = Binary to find...
  768.         move.l    #(manxdivneg_end-manxdivneg)-2,d0    ;length of binary.
  769.         bsr.w    FindBinary
  770.         bne.s    not_found14
  771.  
  772.         st    patched
  773.  
  774. *-------------- patch manx divneg
  775.  
  776.         lea    manxdivneg020(pc),a1        ;00
  777.         exg.l    a1,a0
  778.         move.l    #manxdivneg020_end-manxdivneg020,d0
  779.         bsr.w    CopyMem
  780.         
  781.         lea    Patched.txt(pc),a0
  782.         bsr.w    PutString
  783.         bra.s    was_found14
  784.  
  785. *-------------- skip patching Multiply Signed routine..
  786.  
  787. not_found14:    lea    NotPatched.txt(pc),a0
  788.         bsr.w    PutString
  789.  
  790. was_found14:
  791.  
  792.  
  793. ********************************************************************************
  794.  
  795. _PASS15:
  796.         lea    Find_Divsl6.l.txt(pc),a0
  797.         bsr.w    PutString
  798.  
  799.         move.l    ProgBuff(pc),a0        ;a0.l = Start of file SOF
  800.         move.l    a0,a1
  801.         add.l    ProgSize(pc),a1        ;a1.l = End of file EOF
  802.         lea    divides5(pc),a2        ;a2.l = Binary to find...
  803.         move.l    #(divides5_end-divides5)-2,d0    ;length of binary.
  804.         bsr.w    FindBinary
  805.         bne.s    not_found15
  806.  
  807.         st    patched
  808.  
  809. *-------------- patch div
  810.  
  811.         lea    div5(pc),a1        ;00
  812.         exg.l    a1,a0
  813.         move.l    #div5_end-div5,d0
  814.         bsr.w    CopyMem
  815.         
  816.         lea    Patched.txt(pc),a0
  817.         bsr.w    PutString
  818.         bra.s    was_found15
  819.  
  820. *-------------- skip patching Multiply Signed routine..
  821.  
  822. not_found15:    lea    NotPatched.txt(pc),a0
  823.         bsr.w    PutString
  824.  
  825. was_found15:
  826.  
  827.  
  828.         movem.l    (sp)+,d0-d7/a0-a6
  829.         rts
  830.         
  831.  
  832.  
  833. sort_destname:    lea    volpath,a3
  834.         tst.b    (a3)
  835.         beq.s    use_extension
  836.  
  837.         lea    finalname,a5
  838.         move.l    a5,a1
  839.         move.l    a3,a0
  840.         move.l    rtfl_Name(a6),d1
  841.         beq.w    nextname
  842.         
  843. _bytecopy:    move.b    (a0)+,(a1)+
  844.         bne.s    _bytecopy
  845.         cmp.b    #":",-2(a1)
  846.         bne.s    _add_slash
  847.         tst.b    -(a1)
  848.         bra.s    _no_slash
  849. _add_slash:    tst.b    -(a1)
  850.         move.b    #"/",(a1)+
  851. _no_slash:    move.l    d1,a0
  852. _bytecopy2:    move.b    (a0)+,(a1)+
  853.         bne.s    _bytecopy2
  854.         clr.b    (a1)+
  855.         move.l    a5,d0
  856.         bra.s    done_name
  857.  
  858. use_extension:    move.l    a0,d0
  859.         moveq    #-1,d3            ;d4=0
  860. getlen2        addq.l    #1,d3            ;increase string length by 1
  861.         tst.b    (a0)+            ;increase position
  862.         bne.s    getlen2            ;nope not found, so keep on
  863.         tst.b    -(a0)
  864.         move.b    #".",(a0)+
  865.         move.b    #"0",(a0)+
  866.         move.b    #"2",(a0)+
  867.         move.b    #"0",(a0)+
  868.         clr.b    (a0)+
  869. done_name:
  870. *-------------- returns d0.l = filename..
  871.  
  872.         rts
  873.         
  874. *******************************************************************************
  875. * putstr
  876. * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  877. * Sends a ascii text string to current console output
  878. * $Inputs:    a0.l = String ptr (null terminated)
  879. *******************************************************************************
  880.  
  881. PutString
  882. putstr:        movem.l    d0-d7/a1-a6,-(sp)
  883.         move.l    a0,d2
  884.         moveq    #-1,d3            ;d4=0
  885. getlen3        addq.l    #1,d3            ;increase string length by 1
  886.         tst.b    (a0)+            ;increase position
  887.         bne.s    getlen3            ;nope not found, so keep on
  888.         move.l    _DOSBase(pc),a6
  889.         jsr    _LVOOutput(a6)        ;get output base
  890.         move.l    d0,d1
  891.         jsr    _LVOWrite(a6)        ;print error msg to cli
  892.         movem.l    (sp)+,d0-d7/a1-a6
  893.         rts
  894.                 
  895. *******************************************************************************
  896. * _LoadDOSFile :- Loads an AmigaDOS file from any device into memory
  897. * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  898. * INPUTS:    a0 (.L)    = Filename
  899. *
  900. * OUTPUTS:    d0 (.L) = Result Code (0=File Ok,-1=Load Failed!)    
  901. *        d1 (.L) = Length
  902. *******************************************************************************
  903.     
  904. LoadDOSFile:    movem.l    d2-d7/a0/a2-a6,-(sp)
  905.         clr.l    ProgHandle
  906.         clr.l    ProgBuff
  907.         clr.l    ProgSize
  908.  
  909. ;-------------- Open file
  910.         move.l    a0,d1            ;get filename
  911.         move.l    #MODE_OLDFILE,d2
  912.         move.l    _DOSBase(pc),a6
  913.         jsr    _LVOOpen(a6)        ;open file
  914.         move.l    d0,ProgHandle
  915.         beq.s    NotFound
  916.  
  917. ;-------------- Get Length of file
  918.  
  919.         move.l    d0,d5            ;ProgHandle
  920.         move.l    d5,d1            ;file handle
  921.         moveq    #0,d2
  922.         moveq    #1,d3
  923.         jsr    _LVOSeek(a6)        ;seek start of file
  924.         move.l    d5,d1            ;file handle
  925.         moveq    #0,d2
  926.         moveq    #-1,d3
  927.         jsr    _LVOSeek(a6)        ;seek end of file
  928.         move.l    d0,ProgSize
  929.  
  930. ;-------------- Allocate Memory for file
  931.  
  932.         move.l    4.w,a6            ;get execbase
  933.         move.l    #MEMF_PUBLIC,d1        ;we want public mem
  934.         jsr    _LVOAllocMem(a6)    ;allocate it...
  935.         move.l    d0,ProgBuff        ;save base
  936.         beq.b    TooBig            ;fail?
  937.  
  938. ;-------------- Load in whole file
  939.                 
  940.         move.l    ProgHandle(pc),d1
  941.         move.l    ProgBuff,d2
  942.         move.l    ProgSize(pc),d3
  943.         move.l    _DOSBase(pc),a6
  944.         jsr    _LVORead(a6)        ;read file
  945.  
  946. ;-------------- Close file
  947.  
  948. CloseFile:    move.l    ProgHandle(pc),d1
  949.         jsr    _LVOClose(a6)        ;close file
  950.  
  951.         move.l    ProgSize(pc),d1        ;d1=ProgSize
  952.         move.l    ProgBuff(pc),a1        
  953.  
  954.         movem.l    (sp)+,d2-d7/a0/a2-a6
  955.         moveq    #0,d0            ;resultcode (okay)
  956.         rts
  957.  
  958. NotFound:    movem.l    (sp)+,d2-d7/a0/a2-a6
  959.         moveq    #-1,d0            ;file not found error-code
  960.         rts
  961.  
  962. TooBig:        move.l    ProgHandle(pc),d1
  963.         move.l    _DOSBase(pc),a6
  964.         jsr    _LVOClose(a6)        ;close file
  965.         movem.l    (sp)+,d2-d7/a0/a2-a6
  966.         moveq    #-2,d0            ;file too big error-code
  967. NotAlloc    rts
  968.  
  969.  
  970.  
  971.  
  972. ;-------------- Free Memory for DOSFile
  973.  
  974. FreeDOSFile:    move.l    (AbsExecBase).w,a6    ;get execbase
  975.  
  976.         move.l    ProgBuff(pc),d0        ;ptr to our RS.Variables base
  977.         beq.s    NotAlloc1
  978.         move.l    d0,a1
  979.         move.l    ProgSize(pc),d0        ;no. of Bytes to free
  980.         beq.s    NotAlloc1
  981.         jsr    _LVOFreeMem(a6)        ;free the memory
  982.         clr.l    ProgBuff
  983.         clr.l    ProgSize
  984.  
  985. NotAlloc1:    rts
  986.  
  987. *******************************************************************************
  988. * SaveMem2File
  989. * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  990. * $Inputs:    a0.l    = Filename
  991. *        a1.l    = Mem Address
  992. *        d1.l    = Save Length
  993. *
  994. * $Outputs:    d0.l    = 0 - success
  995. *        d0.l    = 1 - failure
  996. *******************************************************************************
  997.  
  998. SaveDOSFile:    movem.l    d2-d7/a0-a6,-(sp)
  999.         move.l    a1,d5            ;progbuffer
  1000.         move.l    d1,d6            ;proglength
  1001.         beq.s    _NoGain
  1002.  
  1003.         move.l    a0,d1            ;filename
  1004.         move.l    #MODE_NEWFILE,d2
  1005.         move.l    _DOSBase(pc),a6
  1006.         jsr    _LVOOpen(a6)
  1007.         move.l    d0,d7
  1008.         beq.b    _SaveError
  1009.  
  1010.         move.l    d7,d1            ;fh...
  1011.         move.l    d5,d2            ;adr
  1012.         move.l    d6,d3            ;length
  1013.         jsr    _LVOWrite(a6)        ;write file
  1014.  
  1015.         move.l    d7,d1
  1016.         jsr    _LVOClose(a6)        ;close file
  1017. _NoGain:    movem.l    (sp)+,d2-d7/a0-a6
  1018.         moveq    #0,d0
  1019.         rts
  1020. _SaveError:    movem.l    (sp)+,d2-d7/a0-a6
  1021.         moveq    #1,d0
  1022.         rts
  1023.  
  1024.  
  1025.  
  1026.  
  1027. *******************************************************************************
  1028. * FindString
  1029. * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1030. * This routine will scan through Memory for a ascii (case dependant) string.
  1031. * The routine will not find its 'search string' if the start and end addresses 
  1032. * are within the same address range as an added precaution.
  1033. *
  1034. * INPUTS ;    a0.l=start address for search
  1035. *         a1.l=end address for search
  1036. *         a2.l=string to search for
  1037. *
  1038. * OUTPUTS;    d0.b=If failed to located string =$FF.B, else =$00.B FOUND!
  1039. *        a0.l=ptr to string
  1040. *******************************************************************************
  1041.         cnop    0,4
  1042. FindBinary:    movem.l    a1-a6,-(sp)
  1043.         move.l    d0,d4
  1044.         bsr.s    FindBin
  1045.         movem.l    (sp)+,a1-a6
  1046.         tst.l    d0
  1047.         rts
  1048.         
  1049.         cnop    0,4
  1050. FindStr:    move.l    a2,-(sp)
  1051.         moveq    #-3,d4            ;d4=0
  1052. .getlen        addq.l    #1,d4            ;increase string length by 1
  1053.         tst.b    (a2)+            ;increase position
  1054.         bne.s    .getlen            ;nope not found, so keep on
  1055.         move.l    (sp)+,a2
  1056.  
  1057. FindBin:    move.l    a2,a3            ;copy string ptr
  1058.         lea    _kkeepon(pc),a4        ;a4=Keepon sub routine
  1059.         moveq    #0,d5            ;d5=0
  1060. _Not_It        move.l    a3,a2            ;a3=search string ptr
  1061.         move.b    (a2)+,d2        ;put char to test into d2
  1062.  
  1063. _kkeepon:    move.b    (a0)+,d1        ;incr search pos
  1064.         cmp.l    a1,a0            ;end of Memory region reached?
  1065.         blt.s    _contt            ;yes,so string wasn`t found!
  1066.         moveq    #-1,d0            ;d0=not found!
  1067.         rts
  1068.  
  1069.         cnop    0,4
  1070. _contt        cmp.b    d1,d2            ;does this Byte match string Byte?
  1071.         beq.s    _nByte            ;yes!,lets investigate more...
  1072.         jmp    (a4)            ;nope so keep on searching
  1073.  
  1074.         cnop    0,4
  1075. _nByte:        move.l    d4,d3
  1076. _nloop        move.b    (a0)+,d5
  1077.         cmp.b    (a2)+,d5
  1078.         dbne    d3,_nloop
  1079.         bne.s    _Not_It
  1080.  
  1081.         move.l    a0,d0            ;d0=ptr to text found!
  1082.         sub.l    d4,d0
  1083.         subq    #2,d0            ;correct offset ptr
  1084.  
  1085.         move.l    d0,a0
  1086.         moveq    #0,d0
  1087.         rts
  1088.  
  1089.         cnop    0,4
  1090. Start20        dc.l    '*Art'
  1091. CopyMem
  1092. Quicker:    moveq    #16,d1
  1093.         cmp.l    d1,d0
  1094.         bcs.s    tinycpy
  1095.         move.w    a0,d1
  1096.         ror.l    #2,d1
  1097.         move.w    a1,d1
  1098.         rol.l    #2,d1
  1099.         andi.w    #15,d1
  1100.         beq.s    xa0la1l
  1101.         move.w    tbl(pc,d1.w*2),d1
  1102.         jmp    tbl(pc,d1.w)
  1103.  
  1104.         ds.b    2
  1105.         ds.b    2
  1106.  
  1107. tbl    dc.w    xa0la1l-tbl
  1108.     dc.w    xa0la11-tbl
  1109.     dc.w    xa0la1e-tbl
  1110.     dc.w    xa0la13-tbl
  1111.     dc.w    xa01a1l-tbl
  1112.     dc.w    xa01a11-tbl
  1113.     dc.w    xa01a1e-tbl
  1114.     dc.w    xa01a13-tbl
  1115.     dc.w    xa0ea1l-tbl
  1116.     dc.w    xa0ea11-tbl
  1117.     dc.w    xa0ea1e-tbl
  1118.     dc.w    xa0ea13-tbl
  1119.     dc.w    xa03a1l-tbl
  1120.     dc.w    xa03a11-tbl
  1121.     dc.w    xa03a1e-tbl
  1122.     dc.w    xa03a13-tbl
  1123.  
  1124. tloop1        move.b    (a0)+,(a1)+
  1125. tinycpy        dbf    d0,tloop1
  1126.         rts
  1127.  
  1128. xa01a13:
  1129. xa03a11:
  1130. xa03a13:    move.b    (a0)+,(a1)+
  1131.         subq.l    #1,d0
  1132.         bra.s    xa0la1l
  1133.  
  1134.         ds.b    2
  1135.         ds.b    2
  1136.         ds.b    2
  1137.         ds.b    2
  1138.         ds.b    2
  1139.  
  1140. xa01a11:
  1141.     move.b    (a0)+,(a1)+
  1142.     subq.l    #1,d0
  1143. xa0ea1e:
  1144.     move.w    (a0)+,(a1)+
  1145.     subq.l    #2,d0
  1146. xa0la1l:
  1147. xa0la1e:
  1148. xa0ea1l:
  1149.     cmpi.l    #48*8,d0
  1150.     bcs.s    smlmov
  1151.     moveq    #48,d1        ; 12 registers of 4 bytes
  1152.     sub.l    d1,d0
  1153.     movem.l    d2-d7/a2-a6,-(sp)
  1154. bigmov    movem.l    (a0)+,d1-d7/a2-a6
  1155.     movem.l    d1-d7/a2-a6,(a1)
  1156.     moveq    #48,d1
  1157.     adda.l    d1,a1
  1158.     sub.l    d1,d0
  1159.     bcc.s    bigmov
  1160.     add.w    d1,d0
  1161.     movem.l    (sp)+,d2-d7/a2-a6
  1162. smlmov    lsr.w    #1,d0
  1163.     beq.s    even01
  1164.     bcs.s    sm13
  1165.     lsr.w    #1,d0
  1166.     beq.s    even2
  1167.     bcs.s    sm2
  1168. sm0    subq.w    #1,d0
  1169. loop0    move.l    (a0)+,(a1)+
  1170.     dbf    d0,loop0
  1171. even0    rts
  1172.  
  1173. even01    bcs.s    even1
  1174.     rts
  1175.  
  1176. sm3    subq.w    #1,d0
  1177. loop3    move.l    (a0)+,(a1)+
  1178.     dbf    d0,loop3
  1179. even3    move.w    (a0)+,(a1)+
  1180. even1    move.b    (a0),(a1)
  1181.     rts
  1182.  
  1183. sm13    lsr.w    #1,d0
  1184.     beq.s    even3
  1185.     bcs.s    sm3
  1186. sm1    subq.w    #1,d0
  1187. loop1    move.l    (a0)+,(a1)+
  1188.     dbf    d0,loop1
  1189.     move.b    (a0),(a1)
  1190.     rts
  1191.  
  1192. sm2    subq.w    #1,d0
  1193. loop2    move.l    (a0)+,(a1)+
  1194.     dbf    d0,loop2
  1195. even2    move.w    (a0),(a1)
  1196.     rts
  1197.  
  1198. xa0ea11:
  1199. xa0ea13:
  1200.     move.w    (a0)+,d1
  1201.     ror.w    #8,d1
  1202.     move.b    d1,(a1)+
  1203.     rol.w    #8,d1
  1204.     move.b    d1,(a1)+
  1205.     subq.l    #2,d0
  1206.     bra.s    xa0la11
  1207.  
  1208. xa01a1l:
  1209. xa01a1e:
  1210.     move.b    (a0)+,(a1)+
  1211.     move.b    (a0)+,(a1)+
  1212.     subq.l    #2,d0
  1213. xa03a1e:
  1214. xa03a1l:
  1215.     move.b    (a0)+,(a1)+
  1216.     subq.l    #1,d0
  1217.     bra.w    xa0la11
  1218.  
  1219. xa0la13:
  1220. xa0la11:
  1221.  
  1222.     moveq    #36,d1        ; 8 regs of 4 bytes + roundoff bytes
  1223.     cmp.l    d1,d0
  1224.     bcs.s    tinycp2
  1225. * This is tricky!  They said it couldn't be done...
  1226. unevcpy    movem.l    a2-a4/d2-d7,-(sp)
  1227.     movea.w    d1,a4
  1228.     sub.l    d1,d0
  1229.     movea.l    d0,a2
  1230.     moveq    #32,d1        ; 8 registers of 4 bytes
  1231.     movea.w    d1,a3
  1232. uloop    movem.l    (a0)+,d0-d7
  1233.     rol.l    #8,d0
  1234.     rol.l    #8,d1
  1235.     rol.l    #8,d2
  1236.     rol.l    #8,d3
  1237.     rol.l    #8,d4
  1238.     rol.l    #8,d5
  1239.     rol.l    #8,d6
  1240.     rol.l    #8,d7
  1241.     move.b    d0,(a1)+
  1242.     move.b    d1,d0
  1243.     move.b    d2,d1
  1244.     move.b    d3,d2
  1245.     move.b    d4,d3
  1246.     move.b    d5,d4
  1247.     move.b    d6,d5
  1248.     move.b    d7,d6
  1249.     move.b    (a0)+,d7
  1250.     movem.l    d0-d7,(a1)
  1251.     adda.l    a3,a1
  1252.     move.b    (a0)+,(a1)+    ; even up to next word
  1253.     move.b    (a0)+,(a1)+
  1254.     move.b    (a0)+,(a1)+    ; ... and to next longword
  1255.     suba.l    a4,a2
  1256.     move.l    a2,d0
  1257.     bpl.s    uloop
  1258.     add.w    a4,d0
  1259.     movem.l    (sp)+,a2-a4/d2-d7
  1260.     bra.s    tinycp2
  1261. tloop2    move.b    (a0)+,(a1)+
  1262. tinycp2    dbf    d0,tloop2
  1263. tdone    rts
  1264.  
  1265.     ds.b    2
  1266.     ds.b    2
  1267.     ds.b    2
  1268.     ds.b    2
  1269.     ds.b    2
  1270.     ds.b    2
  1271.     ds.b    4
  1272. Quickest
  1273.     bftst    d0{0:16}
  1274.     bne.s    bigq
  1275.     lsr.w    #2,d0
  1276.     cmp.w    #96,d0
  1277.     bcs.s    smlmovQ
  1278.     moveq    #12,d1
  1279.     sub.w    d1,d0
  1280.     divu.w    d1,d0
  1281.     movem.l    d2-d7/a2-a6,-(sp)
  1282. bigmovQ    movem.l    (a0)+,d1-d7/a2-a6
  1283.     movem.l    d1-d7/a2-a6,(a1)
  1284.     lea    48(a1),a1
  1285.     dbf    d0,bigmovQ
  1286.     swap    d0
  1287.     movem.l    (sp)+,d2-d7/a2-a6
  1288.     bra.s    smlmovQ
  1289. qloop    move.l    (a0)+,(a1)+
  1290. smlmovQ    dbf    d0,qloop
  1291. done    rts
  1292.  
  1293. bigq    lsr.l    #2,d0
  1294.     moveq    #48,d1
  1295.     sub.l    d1,d0
  1296.     nop
  1297.     divul.l    d1,d1:d0
  1298.     movem.l    d1-d7/a2-a6,-(sp)
  1299. bmovQ2    movem.l    (a0)+,d1-d7/a2-a6
  1300.     movem.l    d1-d7/a2-a6,(a1)
  1301.     lea    48(a1),a1
  1302.     movem.l    (a0)+,d1-d7/a2-a6
  1303.     movem.l    d1-d7/a2-a6,(a1)
  1304.     lea    48(a1),a1
  1305.     movem.l    (a0)+,d1-d7/a2-a6
  1306.     movem.l    d1-d7/a2-a6,(a1)
  1307.     lea    48(a1),a1
  1308.     movem.l    (a0)+,d1-d7/a2-a6
  1309.     movem.l    d1-d7/a2-a6,(a1)
  1310.     lea    48(a1),a1
  1311.     dbf    d0,bmovQ2
  1312.     sub.l    #$10000,d0
  1313.     bcc.s    bmovQ2
  1314.     movem.l    (sp)+,d0/d2-d7/a2-a6
  1315.     bra.s    smlmovQ
  1316.  
  1317. Stop20
  1318. Quicker20    =    Quicker-Start20
  1319. Quickest20    =    Quickest-Start20
  1320. CopyLen20    =    Stop20-Start20
  1321.  
  1322. About.txt    dc.b    $1b,'c',$a
  1323.         dc.b    $1b,'[1mPatchFor020',$1b,'[1m',$1b,'[22m ',$1b,'[33m(Public) ',$1b,'[32m1.01',$1b,'[3m',$1b,'[31m by 2-Cool of ',$1b,'[23m',$1b,'[3mEX4! ',$1b,'[23m',$1b,'[3m',$1b,'[23m',$a
  1324.         dc.b    'Copyright © 1995. All Rights Are Reserved.',$a
  1325.         dc.b    'Last Assembled: July-1995.',$a,$a,0
  1326. skip_save.txt:    dc.b    'No patches... skipping saving... ',$a,0
  1327.         even
  1328. LFs.Txt:
  1329. LF.txt        dc.b    10,0
  1330. Load.txt    dc.b    10,'Loading file.. ',0
  1331. Save.txt    dc.b    10,'Saving file.. ',0
  1332. NoPath.txt:    dc.b    10,'No Destination Path Specified!',10
  1333.         dc.b    'Adding ".020" extension to save filename(s)..',10,10,0
  1334. ErrorMem.txt:    dc.b    'Error: Out Of Memory.. not enough for load buffers...',0
  1335. ErrorLoad.txt    dc.b    'Error: Skipping file, failed to load..',10,0
  1336. ErrorSave.txt    dc.b    'Error: Skipping file, failed to save..',10,0
  1337. Done.txt:    dc.b    10,'Session Done...',10,0
  1338.         even
  1339. Find_Muls.l.txt    dc.b    'Scanning for 68k SAS/C Compiler "Unsigned Long Multiplication" routines...',$a,0
  1340.         even
  1341. Find_Mulu.l.txt    dc.b    'Scanning for 68k SAS/C Compiler "Signed Long Multiplication" routines...',$a,0
  1342.         even
  1343. Find_Divsl.l.txt  dc.b    'Scanning for 68k SAS/C Compiler "Signed Long Division" routines...',$a,0
  1344. Find_Divsl2.l.txt  dc.b    'Scanning for Compiler Strain #1 "Divu.l,Divs.l & remainder" routines...',$a,0
  1345. Find_Divsl3.l.txt  dc.b    'Scanning for Compiler Strain #2 "Divu.l,Divs.l & remainder" routines...',$a,0
  1346. Find_Divsl4.l.txt  dc.b    'Scanning for Compiler Strain #3 "Divu.l,Divs.l & remainder" routines...',$a,0
  1347. Find_Divsl5.l.txt  dc.b    'Scanning for Manx C Compiler "Modu.l" routines...',$a,0
  1348. Find_Divsl6.l.txt  dc.b    'Scanning for DICE C Compiler "Divs.l" routines...',$a,0
  1349.         even
  1350. manxmulu.txt:    dc.b    'Scanning for Manx C Compiler "Mulu.l" routines...',$a,0
  1351.         even
  1352. manxdivs.txt:    dc.b    'Scanning for Manx C Compiler "Divs.l" routines...',$a,0
  1353.         even
  1354. manxdivneg.txt:    dc.b    'Scanning for Manx C Compiler "Divs.l remainder" routines...',$a,0
  1355.         even
  1356. Find_MulsOther.l.txt    dc.b    'Scanning for C Compiler Strain #1 "Signed Long Multiply" routines...',$a,0
  1357.         even
  1358. Find_MulsOther2.l.txt    dc.b    'Scanning for Compiler Strain #2 "Signed Long Multiply" routines...',$a,0
  1359.         even
  1360. Find_MulsOther3.l.txt    dc.b    'Scanning for Compiler Strain #3 "Signed Long Multiply & Remainder" routines...',$a,0
  1361.         even
  1362. Find_MulsDice.l.txt    dc.b    'Scanning for 68k DICE C Compilers "Signed Long Multiplication" routines...',$a,0
  1363.         even
  1364. NotPatched.txt:    dc.b    'Not Found... ',$a,$a,0
  1365.         even
  1366. NotPatches.txt:    dc.b    'No patches... skipping saving... ',$a,$a,0
  1367.         even
  1368. Patched.txt:    dc.b    'A SPEEDUP GAIN! Found & Patched to MC68020+ !!!',$a,$a,0
  1369.         even
  1370. Loading.txt    dc.b    'Please select Executable File to Patch... ',0
  1371. saving.txt    dc.b    'Saving Program... ',0
  1372. alldone.txt    dc.b    $a,'All Done!',$a,$a,$a,0
  1373.         even
  1374.  
  1375. Text89        dc.b    "Select Destination Path..",0
  1376. Text66        dc.b    "Select File(s)...",0
  1377.         even
  1378. Tags9        dc.l    RTFI_Flags,FREQF_MULTISELECT
  1379.         dc.l    TAG_END
  1380. Tags11        dc.l    RTFI_Flags,FREQF_NOFILES
  1381.         dc.l    TAG_END
  1382.  
  1383. defdir_tags:    dc.l    RTFI_Dir,DefDir.txt
  1384.         dc.l    TAG_END
  1385.  
  1386. DefDir.txt:    dc.b    'SYS:',0
  1387.  
  1388. DOSName        dc.b    'dos.library',0
  1389. ReqName        dc.b    'reqtools.library',0
  1390.         cnop    0,2
  1391. _DOSBase:    ds.l    1
  1392. _RTBase:    ds.l    1
  1393.  
  1394. ProgHandle:    ds.l    1
  1395. ProgBuff:    ds.l    1
  1396. ProgSize:    ds.l    1
  1397.  
  1398. filereq        ds.l    1
  1399. volreq        ds.l    1
  1400. flist        ds.l    1
  1401. Savename    dc.l    0
  1402.  
  1403.  
  1404.         cnop    0,4        
  1405. *******************************************************************************
  1406. * Lattice SAS/C slow 68000 signed multiplication 
  1407.  
  1408. SASC_Muls    dc.w    $48E7        ;32 bytes length
  1409.         dc.w    $3000
  1410.         dc.w    $2400
  1411.         dc.w    $2601
  1412.         dc.w    $4842
  1413.         dc.w    $4843
  1414.         dc.w    $C4C1
  1415.         dc.w    $C6C0
  1416.         dc.w    $C0C1
  1417.         dc.w    $D443
  1418.         dc.w    $4842
  1419.         dc.w    $4242
  1420.         dc.w    $D082
  1421.         dc.w    $4CDF
  1422.         dc.w    $000C
  1423.         dc.w    $4E75
  1424. SASC_Muls_End:
  1425.  
  1426. my020_Muls:    muls.l    d1,d0        ;6 bytes, patch at offset 0
  1427.         rts
  1428.         dc.b    'MC68020 Patch SASC Muls'
  1429. my020_Muls_End:
  1430.  
  1431.  
  1432. *******************************************************************************
  1433. * Lattice SAS/C slow 68000 unsigned multiplication 
  1434.  
  1435.         cnop    0,4
  1436. SASC_Mulu:    dc.w    $48E7        ;46 bytes
  1437.         dc.w    $7000
  1438.         dc.w    $2400
  1439.         dc.w    $6720
  1440.         dc.w    $4A81
  1441.         dc.w    $6604
  1442.         dc.w    $4280
  1443.         dc.w    $6018
  1444.         dc.w    $2600
  1445.         dc.w    $C6C1
  1446.         dc.w    $4842
  1447.         dc.w    $C4C1
  1448.         dc.w    $4842
  1449.         dc.w    $4242
  1450.         dc.w    $D682
  1451.         dc.w    $4841
  1452.         dc.w    $C0C1
  1453.         dc.w    $4840
  1454.         dc.w    $4240
  1455.         dc.w    $D083
  1456.         dc.w    $4CDF
  1457.         dc.w    $000E
  1458.         dc.w    $4E75
  1459. SASC_Mulu_End:
  1460.  
  1461. my020_Mulu:    mulu.l    d1,d0        ;6 bytes, patch at offset 0
  1462.         rts
  1463.         dc.b    'MC68020 Patch for SAS/C Mulu.l'
  1464.         ds.b    20
  1465. my020_Mulu_End:
  1466.  
  1467.         cnop    0,4
  1468. OTHER_Muls:    movem.l    d2/d3,-(sp)
  1469.         move.w    d1,d2
  1470.         move.l    d1,d3
  1471.         mulu    d0,d2
  1472.         swap    d3
  1473.         mulu    d0,d3
  1474.         swap    d3
  1475.         clr.w    d3
  1476.         add.l    d3,d2
  1477.         swap    d0
  1478.         mulu    d1,d0
  1479.         swap    d0
  1480.         clr.w    d0
  1481.         add.l    d2,d0
  1482.         movem.l    (sp)+,d2/d3
  1483.         rts
  1484. OTHER_Muls_End
  1485.  
  1486.  
  1487.         cnop    0,4
  1488. OTHER2_Muls:    movem.l    d2/d3,-(sp)
  1489.         move.w    d1,d2
  1490.         mulu.w    d0,d2
  1491.         move.l    d1,d3
  1492.         swap    d3
  1493.         mulu.w    d0,d3
  1494.         swap    d3
  1495.         clr.w    d3
  1496.         add.l    d3,d2
  1497.         swap    d0
  1498.         mulu.w    d1,d0
  1499.         swap    d0
  1500.         clr.w    d0
  1501.         add.l    d2,d0
  1502.         movem.l    (sp)+,d2/d3
  1503.         rts    
  1504. OTHER2_Muls_End
  1505.  
  1506. *******************************************************************************
  1507. * Long Multiplication (SIGNED)
  1508. *
  1509. * DICE C (STACK COMPILED) VERSION
  1510. * -------------------------------
  1511.  
  1512.         cnop    0,4
  1513. _Dice_Muls:    movem.l    d0/d1,-(sp)
  1514.         swap    d0
  1515.         mulu    d1,d0
  1516.         swap    d1
  1517.         mulu    2(sp),d1
  1518.         add.l    d1,d0
  1519.         swap    d0
  1520.         clr.w    d0
  1521.         move.w    2(sp),d1
  1522.         mulu    6(sp),d1
  1523.         add.l    d1,d0
  1524.         addq.l    #8,sp
  1525. _Dice_Muls_End    rts
  1526.  
  1527.         cnop    0,4
  1528. _Dice_Muls020:    muls.l    d0,d1
  1529.         move.l    d1,d0
  1530.         rts
  1531. _Dice_Muls020_End:
  1532.  
  1533.  
  1534.  
  1535.         cnop    0,4
  1536.  
  1537. *******************************************************************************
  1538. * Lattice SAS/C slow 68000 signed division
  1539.  
  1540. SASC_Divsl:    dc.w    $4A80        ;194 bytes length
  1541.         dc.w    $6A00
  1542.         dc.w    $001E
  1543.         dc.w    $4480
  1544.         dc.w    $4A81
  1545.         dc.w    $6A00
  1546.         dc.w    $000C
  1547.         dc.w    $4481
  1548.         dc.w    $6100
  1549.         dc.w    $0020
  1550.         dc.w    $4481
  1551.         dc.w    $4E75
  1552.         dc.w    $6100
  1553.         dc.w    $0018
  1554.         dc.w    $4480
  1555.         dc.w    $4481
  1556.         dc.w    $4E75
  1557.         dc.w    $4A81
  1558.         dc.w    $6A00
  1559.         dc.w    $000C
  1560.         dc.w    $4481
  1561.         dc.w    $6100
  1562.         dc.w    $0006
  1563.         dc.w    $4480
  1564.         dc.w    $4E75
  1565.         dc.w    $2F02
  1566.         dc.w    $4841
  1567.         dc.w    $3401
  1568.         dc.w    $6600
  1569.         dc.w    $0022
  1570.         dc.w    $4840
  1571.         dc.w    $4841
  1572.         dc.w    $4842
  1573.         dc.w    $3400
  1574.         dc.w    $6700
  1575.         dc.w    $0006
  1576.         dc.w    $84C1
  1577.         dc.w    $3002
  1578.         dc.w    $4840
  1579.         dc.w    $3400
  1580.         dc.w    $84C1
  1581.         dc.w    $3002
  1582.         dc.w    $4842
  1583.         dc.w    $3202
  1584.         dc.w    $241F
  1585.         dc.w    $4E75
  1586.         dc.w    $2F03
  1587.         dc.w    $7610
  1588.         dc.w    $0C41
  1589.         dc.w    $0080
  1590.         dc.w    $6400
  1591.         dc.w    $0006
  1592.         dc.w    $E199
  1593.         dc.w    $5143
  1594.         dc.w    $0C41
  1595.         dc.w    $0800
  1596.         dc.w    $6400
  1597.         dc.w    $0006
  1598.         dc.w    $E999
  1599.         dc.w    $5943
  1600.         dc.w    $0C41
  1601.         dc.w    $2000
  1602.         dc.w    $6400
  1603.         dc.w    $0006
  1604.         dc.w    $E599
  1605.         dc.w    $5543
  1606.         dc.w    $4A41
  1607.         dc.w    $6B00
  1608.         dc.w    $0006
  1609.         dc.w    $E399
  1610.         dc.w    $5343
  1611.         dc.w    $3400
  1612.         dc.w    $E6A8
  1613.         dc.w    $4842
  1614.         dc.w    $4242
  1615.         dc.w    $E6AA
  1616.         dc.w    $4843
  1617.         dc.w    $80C1
  1618.         dc.w    $3600
  1619.         dc.w    $3002
  1620.         dc.w    $3403
  1621.         dc.w    $4841
  1622.         dc.w    $C4C1
  1623.         dc.w    $9082
  1624.         dc.w    $6400
  1625.         dc.w    $0006
  1626.         dc.w    $5343
  1627.         dc.w    $D081
  1628.         dc.w    $7200
  1629.         dc.w    $3203
  1630.         dc.w    $4843
  1631.         dc.w    $E7B8
  1632.         dc.w    $4840
  1633.         dc.w    $C141
  1634.         dc.w    $261F
  1635.         dc.w    $241F
  1636.         dc.w    $4E75
  1637. SASC_Divsl_End:
  1638.  
  1639.  
  1640. my020_Divsl:    divsl.l    d1,d1:d0    ;6 bytes, patch at offset 32 bytes in
  1641.         rts
  1642.         dc.b    'MC68020 Patch for SAS/C Divsl.l routines!'
  1643.         ds.b    147
  1644. my020_Divsl_End
  1645.  
  1646.  
  1647.  
  1648.         cnop    0,4
  1649. *-------------- divide signed long (result)
  1650.  
  1651. _Divsl.l.020:    divs.l    d1,d0            ; 020 optimised version
  1652.         rts
  1653. _Divsl.l.020_end
  1654.  
  1655.         cnop    0,4
  1656. *-------------- divide signed long (remainder)
  1657.  
  1658. _Divsl.r020:    move.l    d1,-(sp)        * 020 optimised version
  1659.         divsl.l    d1,d1:d0
  1660.         move.l    d1,d0
  1661.         move.l    (sp)+,d1
  1662. ;        tst.l    d0
  1663.         rts
  1664. _Divsl.r020_end
  1665.  
  1666.         cnop    0,4
  1667. *-------------- divide unsigned long (result)
  1668.  
  1669. _Divul.l.020:    divu.l    d1,d0            ; 020 optimised version
  1670.         rts
  1671. _Divul.l.020_end
  1672.  
  1673.         cnop    0,4
  1674. *-------------- divide unsigned long (remainder)
  1675.  
  1676. _Divul.r020:    move.l    d1,-(sp)        * 020 optimised version
  1677.         divul.l    d1,d1:d0
  1678.         move.l    d1,d0
  1679.         move.l    (sp)+,d1
  1680. ;        tst.l    d0
  1681.         rts
  1682. _Divul.r020_end:
  1683.  
  1684.         cnop    0,4
  1685. divides:    dc.w    $2F01
  1686.         dc.w    $3F04
  1687.         dc.w    $9844
  1688.         dc.w    $4A80
  1689.         dc.w    $6A04
  1690.         dc.w    $4480
  1691.         dc.w    $5244
  1692.         dc.w    $4A81
  1693.         dc.w    $6A06
  1694.         dc.w    $4481
  1695.         dc.w    $0A44
  1696.         dc.w    $0001
  1697.         dc.w    $613E
  1698.         dc.w    $4A44
  1699.         dc.w    $6702
  1700.         dc.w    $4480
  1701.         dc.w    $381F
  1702.         dc.w    $221F
  1703.         dc.w    $4A80
  1704.         dc.w    $4E75
  1705.         dc.w    $2F01
  1706.         dc.w    $3F04
  1707.         dc.w    $9844
  1708.         dc.w    $4A80
  1709.         dc.w    $6A04
  1710.         dc.w    $4480
  1711.         dc.w    $5244
  1712.         dc.w    $4A81
  1713.         dc.w    $6A02
  1714.         dc.w    $4481
  1715.         dc.w    $611A
  1716.         dc.w    $2001
  1717.         dc.w    $60D8
  1718.         dc.w    $2F01
  1719.         dc.w    $6112
  1720.         dc.w    $2001
  1721.         dc.w    $221F
  1722.         dc.w    $4A80
  1723.         dc.w    $4E75
  1724.         dc.w    $2F01
  1725.         dc.w    $6106
  1726.         dc.w    $221F
  1727.         dc.w    $4A80
  1728.         dc.w    $4E75
  1729.         dc.w    $4841
  1730.         dc.w    $4A41
  1731.         dc.w    $661C
  1732.         dc.w    $4841
  1733.         dc.w    $3F01
  1734.         dc.w    $3F00
  1735.         dc.w    $4240
  1736.         dc.w    $4840
  1737.         dc.w    $80C1
  1738.         dc.w    $2200
  1739.         dc.w    $4840
  1740.         dc.w    $321F
  1741.         dc.w    $82DF
  1742.         dc.w    $3001
  1743.         dc.w    $4241
  1744.         dc.w    $4841
  1745.         dc.w    $4E75
  1746.         dc.w    $4841
  1747.         dc.w    $3F02
  1748.         dc.w    $2F03
  1749.         dc.w    $2601
  1750.         dc.w    $2200
  1751.         dc.w    $4241
  1752.         dc.w    $4841
  1753.         dc.w    $4840
  1754.         dc.w    $4240
  1755.         dc.w    $343C
  1756.         dc.w    $000F
  1757.         dc.w    $D080
  1758.         dc.w    $D381
  1759.         dc.w    $B681
  1760.         dc.w    $6204
  1761.         dc.w    $9283
  1762.         dc.w    $5240
  1763.         dc.w    $51CA
  1764.         dc.w    $FFF2
  1765.         dc.w    $261F
  1766.         dc.w    $341F
  1767.         dc.w    $4E75
  1768. divides_end:
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774. divides2:    dc    $2F02,$2401,$2200,$0C82,$0000,$FFFF,$6E1C,$3C41
  1775.         dc    $4241,$4841,$82C2,$2001,$4841,$300E,$80C2,$3200
  1776.         dc    $4240,$4840,$C141,$241F,$4E75,$2001,$4240,$4840
  1777.         dc    $4841,$4241,$2C42,$740F,$D281,$D180,$BDC0,$6E04
  1778.         dc    $908E,$5241,$51CA,$FFF2,$C141,$241F,$4E75,$3F03
  1779.         dc    $487A,$0016,$2F02,$2401,$5BC3,$6A02,$4482,$2200
  1780.         dc    $6AA4,$4481,$4603,$609E,$4A03,$6702,$4480,$361F,$4E75
  1781. divides2_end:
  1782.         
  1783. Divul.rem:    divul.l    d1,d1:d0        ; 020 optimised version
  1784.         rts
  1785. Divul.rem_end
  1786.  
  1787. Divsl.neg:    divsl.l    d1,d1:d0        ; 020 optimised version
  1788.         neg.l    d1
  1789.         rts
  1790. Divsl.neg_end:
  1791.  
  1792.  
  1793.  
  1794. *******************************************************************************
  1795. * Long Multiplication (SIGNED & REMAINDER)
  1796. *
  1797. * GENERIC COMPILER VERSION 3
  1798. * --------------------------
  1799.  
  1800. Mul3_020    muls.l    d1,d1:d0
  1801.         rts
  1802. Mul3_020_End
  1803.  
  1804.         
  1805. Mul3:
  1806. _LongMul1    movem.l    d2-d4,-(sp)
  1807.         move.l    d0,d2
  1808.         move.l    d0,d3
  1809.         swap    d3
  1810.         move.l    d1,d4
  1811.         swap    d4
  1812.         mulu    d1,d0
  1813.         mulu    d3,d1
  1814.         mulu    d4,d2
  1815.         mulu    d4,d3
  1816.         swap    d0
  1817.         add.w    d1,d0
  1818.         moveq    #0,d4
  1819.         addx.l    d4,d4
  1820.         add.w    d2,d0
  1821.         addx.l    d4,d3
  1822.         swap    d0
  1823.         clr.w    d1
  1824.         swap    d1
  1825.         clr.w    d2
  1826.         swap    d2
  1827.         add.l    d2,d1
  1828.         add.l    d3,d1
  1829.         beq.b    lskip
  1830.         ori.b    #2,ccr
  1831. lskip:        movem.l    (sp)+,d2-d4
  1832.         rts
  1833.  
  1834. _LongMul2:    movem.l    d2/d3,-(sp)
  1835.         move.l    d0,d2
  1836.         move.l    d1,d3
  1837.         bsr.b    _LongMul1
  1838.         tst.l    d2
  1839.         bpl.b    lm1
  1840.         sub.l    d3,d1
  1841. lm1:        tst.l    d3
  1842.         bpl.b    lm2
  1843.         sub.l    d2,d1
  1844. lm2:        tst.l    d0
  1845.         bpl.b    lm3
  1846.         not.l    d1
  1847. lm3:        tst.l    d1
  1848.         beq.b    lm4
  1849.         ori.b    #2,ccr
  1850. lm4:        movem.l    (sp)+,d2/d3
  1851.         rts
  1852. Mul3_End
  1853.  
  1854.  
  1855.         cnop    0,4
  1856. *-------------- divide signed long (remainder)
  1857.  
  1858. div        divsl.l    d1,d1:d0
  1859.         exg.l    d0,d1    
  1860.         rts
  1861. div_end
  1862.  
  1863.         cnop    0,4        
  1864. divides3:
  1865.     dc.w    $48E7
  1866.     dc.w    $3000
  1867.     dc.w    $7400
  1868.     dc.w    $B2BC
  1869.     dc.w    $0000
  1870.     dc.w    $FFFF
  1871.     dc.w    $621C
  1872.     dc.w    $80C1
  1873.     dc.w    $6810
  1874.     dc.w    $3600
  1875.     dc.w    $4240
  1876.     dc.w    $4840
  1877.     dc.w    $80C1
  1878.     dc.w    $3400
  1879.     dc.w    $4842
  1880.     dc.w    $3003
  1881.     dc.w    $80C1
  1882.     dc.w    $3400
  1883.     dc.w    $4240
  1884.     dc.w    $4840
  1885.     dc.w    $601A
  1886.     dc.w    $3400
  1887.     dc.w    $4842
  1888.     dc.w    $4240
  1889.     dc.w    $4840
  1890.     dc.w    $760F
  1891.     dc.w    $E38A
  1892.     dc.w    $E390
  1893.     dc.w    $B081
  1894.     dc.w    $6504
  1895.     dc.w    $9081
  1896.     dc.w    $5242
  1897.     dc.w    $51CB
  1898.     dc.w    $FFF2
  1899.     dc.w    $2202
  1900.     dc.w    $4CDF
  1901.     dc.w    12
  1902.     dc.w    $4E75
  1903. divides3_end:
  1904.  
  1905.  
  1906. *-------------- manx_c divide/modu
  1907.  
  1908. div4        divul.l    d1,d1:d0
  1909.         rts
  1910. div4_end
  1911.  
  1912. divides4:    dc.w    $48E7
  1913.         dc.w    $3000
  1914.         dc.w    $4841
  1915.         dc.w    $4A41
  1916.         dc.w    $6620
  1917.         dc.w    $4841
  1918.         dc.w    $3601
  1919.         dc.w    $3400
  1920.         dc.w    $4240
  1921.         dc.w    $4840
  1922.         dc.w    $80C3
  1923.         dc.w    $2200
  1924.         dc.w    $4840
  1925.         dc.w    $3202
  1926.         dc.w    $82C3
  1927.         dc.w    $3001
  1928.         dc.w    $4241
  1929.         dc.w    $4841
  1930.         dc.w    $4CDF
  1931.         dc.w    12
  1932.         dc.w    $4E75
  1933. divides4_end:
  1934.  
  1935.  
  1936. manxmulu020:    mulu.l    d1,d0
  1937.         rts
  1938. manxmulu020_end:
  1939.  
  1940. manxmulu:    movem.l    d1-d3,-(sp)
  1941.         move.w    d1,d2
  1942.         mulu    d0,d2
  1943.         move.l    d1,d3
  1944.         swap    d3
  1945.         mulu    d0,d3
  1946.         swap    d3
  1947.         clr.w    d3
  1948.         add.l    d3,d2
  1949.         swap    d0
  1950.         mulu    d1,d0
  1951.         swap    d0
  1952.         clr.w    d0
  1953.         add.l    d2,d0
  1954.         movem.l    (sp)+,d1-d3
  1955.         rts
  1956. manxmulu_end:
  1957.  
  1958.  
  1959.  
  1960.  
  1961. manxdivs020:    divs.l    d1,d0
  1962.         rts
  1963. manxdivs020_end:
  1964.  
  1965. manxdivs:    dc.w    $48E7
  1966.         dc.w    $4800
  1967.         dc.w    $4284
  1968.         dc.w    $4A80
  1969.         dc.w    $6A04
  1970.         dc.w    $4480
  1971.         dc.w    $5244
  1972.         dc.w    $4A81
  1973.         dc.w    $6A06
  1974.         dc.w    $4481
  1975.         dc.w    $0A44
  1976.         dc.w    $0001
  1977.         dc.w    $613E
  1978.         dc.w    $4A44
  1979.         dc.w    $6702
  1980.         dc.w    $4480
  1981.         dc.w    $4CDF
  1982.         dc.w    $0012
  1983.         dc.w    $4A80
  1984.         dc.w    $4E75
  1985. manxdivs_end:
  1986.  
  1987.  
  1988.  
  1989.  
  1990. manxdivneg020:    move.l    d1,-(sp)
  1991.         divsl.l    d1,d1:d0
  1992.         exg    d0,d1
  1993.         move.l    (sp)+,d1
  1994.         tst.l    d0
  1995.         rts
  1996. manxdivneg020_end:
  1997.  
  1998. manxdivneg:    dc.w    $48E7
  1999.         dc.w    $4800
  2000.         dc.w    $4284
  2001.         dc.w    $4A80
  2002.         dc.w    $6A04
  2003.         dc.w    $4480
  2004.         dc.w    $5244
  2005.         dc.w    $4A81
  2006.         dc.w    $6A02
  2007.         dc.w    $4481
  2008.         dc.w    $611A
  2009.         dc.w    $2001
  2010.         dc.w    $60D8
  2011.         dc.w    $2F01
  2012.         dc.w    $6112
  2013.         dc.w    $2001
  2014.         dc.w    $221F
  2015.         dc.w    $4A80
  2016.         dc.w    $4E75
  2017.         dc.w    $2F01
  2018.         dc.w    $6106
  2019.         dc.w    $221F
  2020.         dc.w    $4A80
  2021.         dc.w    $4E75
  2022. manxdivneg_end:
  2023.  
  2024.  
  2025. div5
  2026. dicediv020:    divs.l    d1,d0            ; 020 optimised version
  2027.         rts
  2028. dicediv020_end
  2029. div5_end
  2030.  
  2031. divides5
  2032. dicediv:    dc.w    $4A81
  2033.         dc.w    $6B08
  2034.         dc.w    $4A80
  2035.         dc.w    $6B12
  2036.         dc.w    $6000
  2037.         dc.w    $22
  2038.         dc.w    $4481
  2039.         dc.w    $4A80
  2040.         dc.w    $6B12
  2041.         dc.w    $6100
  2042.         dc.w    $18
  2043.         dc.w    $4480
  2044.         dc.w    $4E75
  2045.         dc.w    $4480
  2046.         dc.w    $6100
  2047.         dc.w    14
  2048.         dc.w    $4480
  2049.         dc.w    $4E75
  2050.         dc.w    $4480
  2051.         dc.w    $6000
  2052.         dc.w    4
  2053.         dc.w    $4E71
  2054.         dc.w    $4A81
  2055.         dc.w    $671E
  2056.         dc.w    $4841
  2057.         dc.w    $4A41
  2058.         dc.w    $6642
  2059.         dc.w    $2F02
  2060.         dc.w    $4841
  2061.         dc.w    $2400
  2062.         dc.w    $84C1
  2063.         dc.w    $6914
  2064.         dc.w    $2202
  2065.         dc.w    $4241
  2066.         dc.w    $4841
  2067.         dc.w    $7000
  2068.         dc.w    $3002
  2069.         dc.w    $241F
  2070.         dc.w    $4E75
  2071.         dc.w    $2200
  2072.         dc.w    $70FF
  2073.         dc.w    $4E75
  2074.         dc.w    $2F03
  2075.         dc.w    $2400
  2076.         dc.w    $4242
  2077.         dc.w    $4842
  2078.         dc.w    $84C1
  2079.         dc.w    $3602
  2080.         dc.w    $4843
  2081.         dc.w    $4243
  2082.         dc.w    $3400
  2083.         dc.w    $84C1
  2084.         dc.w    $3602
  2085.         dc.w    $2003
  2086.         dc.w    $4242
  2087.         dc.w    $4842
  2088.         dc.w    $2202
  2089.         dc.w    $261F
  2090.         dc.w    $241F
  2091.         dc.w    $4E75
  2092.         dc.w    $48E7
  2093.         dc.w    $3800
  2094.         dc.w    $2400
  2095.         dc.w    $4242
  2096.         dc.w    $4842
  2097.         dc.w    $84C1
  2098.         dc.w    $3602
  2099.         dc.w    $7400
  2100.         dc.w    $3403
  2101.         dc.w    $C6C1
  2102.         dc.w    $4841
  2103.         dc.w    $3802
  2104.         dc.w    $C8C1
  2105.         dc.w    $4843
  2106.         dc.w    $D684
  2107.         dc.w    $9083
  2108.         dc.w    $6B0A
  2109.         dc.w    $2200
  2110.         dc.w    $2002
  2111.         dc.w    $4CDF
  2112.         dc.w    $1C
  2113.         dc.w    $4E75
  2114.         dc.w    $5382
  2115.         dc.w    $D081
  2116.         dc.w    $6BFA
  2117.         dc.w    $2200
  2118.         dc.w    $2002
  2119.         dc.w    $4CDF
  2120.         dc.w    $1C
  2121.         dc.w    $4E75
  2122. dicediv_end:    
  2123. divides5_end
  2124.  
  2125.         section    bssmem,bss
  2126.  
  2127. patched        ds.w    1        
  2128. Array        ds.l    6
  2129. Buffer        ds.b    128
  2130. filename    ds.b    34
  2131. finalname:    ds.b    256
  2132. volpath:    ds.b    128
  2133. hashbuff    ds.b    65536*2
  2134.